home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / CIncludes / Keyboard.h < prev    next >
C/C++ Source or Header  |  1996-05-01  |  4KB  |  148 lines

  1. /*
  2.      File:        Keyboard.h
  3.  
  4.      Contains:    interfaces for keyboard componets
  5.  
  6.      Version:    Technology:    
  7.                  Release:    Universal Interfaces 3.0d3 on Copland DR1
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        If you find a problem with this file, send the file and version
  12.                  information (from above) and the problem description to:
  13.  
  14.                      Internet:    apple.bugs@applelink.apple.com
  15.                      AppleLink:    APPLE.BUGS
  16.  
  17. */
  18. #ifndef __KEYBOARD__
  19. #define __KEYBOARD__
  20.  
  21. #ifndef __CONDITIONALMACROS__
  22. #include <ConditionalMacros.h>
  23. #endif
  24. #ifndef __EVENTS__
  25. #include <Events.h>
  26. #endif
  27. #ifndef __IOITERATOR__
  28. #include <IOIterator.h>
  29. #endif
  30. #ifndef __TIMING__
  31. #include <Timing.h>
  32. #endif
  33.  
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif
  37.  
  38. #if PRAGMA_IMPORT_SUPPORTED
  39. #pragma import on
  40. #endif
  41.  
  42. #if PRAGMA_ALIGN_SUPPORTED
  43. #pragma options align=mac68k
  44. #endif
  45.  
  46. #if FOR_SYSTEM8_PREEMPTIVE
  47. /* Virtual ID for a keyboard  */
  48. typedef UInt32 KeyboardID;
  49. /* System 8.x version of of a Keymap */
  50. typedef Byte KeyboardMap[32];
  51. /* System 8.x version of a virtual key */
  52. typedef UInt8 VirtualKeyCode;
  53. /* System 8.x definition of keyboard modifiers */
  54. typedef UInt16 KeyboardModifiers;
  55. /* System 8.x definition of keyboard direction */
  56.  
  57. enum {
  58.     kKeyDirectionKeyDown        = 0x0001,
  59.     kKeyDirectionKeyUp            = 0x0002,
  60.     kKeyDirectionAutoKeyDown    = 0x0003
  61. };
  62.  
  63. typedef short KeyDirection;
  64. typedef UInt32 KeyboardDeviceMode;
  65. /* Keyboard Event returned from I/O subsystem */
  66. struct LowLevelKeyEvent {
  67.     KeyboardID                         theBoard;
  68.     VirtualKeyCode                     theKey;
  69.     SInt8                             filler1;
  70.     KeyDirection                     direction;
  71.     KeyboardModifiers                 modifiers;
  72.     AbsoluteTime                     theEventTime;
  73. };
  74. typedef struct LowLevelKeyEvent LowLevelKeyEvent;
  75.  
  76.  
  77. enum {
  78.     kKeyboardHardwareTypeUnknown = 0,
  79.     kKeyboardHardwareTypeADB    = 1,
  80.     kKeyboardHardwareTypeSerial    = 2
  81. };
  82.  
  83. typedef UInt32 KeyboardHardwareType;
  84. struct KeyboardIOIteratorData {
  85.     IOCommonInfo                     IOCommon;
  86.     KeyboardHardwareType             theType;
  87.     UInt32                             keycount;
  88.     UInt32                             kcapResID;
  89.     Boolean                         hasNumericKeypad;
  90.     Boolean                         hasLEDFeedback;
  91. };
  92. typedef struct KeyboardIOIteratorData KeyboardIOIteratorData;
  93.  
  94. typedef KeyboardIOIteratorData KeyboardDeviceRecord;
  95.  
  96. enum {
  97.     kKeyboardLEDOff                = false,
  98.     kKeyboardLEDOn                = true
  99. };
  100.  
  101. typedef Boolean KeyboardLEDState;
  102.  
  103. enum {
  104.     kKeyboardLEDNumLock            = 0,
  105.     kKeyboardLEDCapsLock        = 1,
  106.     kKeyboardLEDScrollLock        = 2
  107. };
  108.  
  109. typedef short KeyboardLEDSelector;
  110. extern OSStatus GetKeyMap(KeyboardID theID, KeyboardMap theMap);
  111.  
  112. extern OSStatus KeyboardIsKeyDown(VirtualKeyCode theKey, KeyDirection *keyState, KeyboardModifiers *modifierState);
  113.  
  114. /* Warning: This routine is intended only for clients who need to bypass the events system altogether. */
  115. extern OSStatus GetNextLowLevelKeyEvent(LowLevelKeyEvent *theKey);
  116.  
  117. extern OSStatus GetLastKeypressTime(AbsoluteTime *theTime);
  118.  
  119. extern OSStatus GetKeyboardLEDStatus(KeyboardID theID, short theLight, Boolean *value);
  120.  
  121. extern OSStatus SetKeyboardLEDStatus(KeyboardID theID, short theLight, Boolean value);
  122.  
  123. extern OSStatus GetKeyboardDeviceMode(KeyboardID theID, KeyboardDeviceMode *theMode);
  124.  
  125. extern OSStatus SetKeyboardDeviceMode(KeyboardID theID, KeyboardDeviceMode theMode);
  126.  
  127. /* Device Iteration */
  128. extern OSStatus GetKeyboardDeviceRecord(KeyboardID theID, KeyboardDeviceRecord *theDeviceRecord);
  129.  
  130. extern OSStatus KeyboardGetDeviceData(ItemCount requestItemCount, ItemCount *totalItemCount, KeyboardIOIteratorData *iteratorBuffer);
  131.  
  132. #endif
  133.  
  134. #if PRAGMA_ALIGN_SUPPORTED
  135. #pragma options align=reset
  136. #endif
  137.  
  138. #if PRAGMA_IMPORT_SUPPORTED
  139. #pragma import off
  140. #endif
  141.  
  142. #ifdef __cplusplus
  143. }
  144. #endif
  145.  
  146. #endif /* __KEYBOARD__ */
  147.  
  148.